import React from 'react'
// ===================================================================== Temp
import Table from '#cpt/temp/Table'
import Controls from '#cpt/temp/Controls'
import Confirm from '#cpt/temp/Confirm'
import AddEditModal from '#cpt/temp/AddEditModal'
// ===================================================================== Lazy
const Box = window.$Lazy.load(()=>import('#tp/box/box'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		selectedKeys:[],
		// 提交表单列表
		formData : [
			{ label: '性能参数',		name: 'param_name', 	full:true, type:'textarea', required:true },
			{ label: '参数内容',  	name: 'param_cont', 	full:true, type:'textarea', required:true }
		]
	}
	
	componentDidMount(){
		const { kind_id } = this.props
		this.submit = { kind_id }
	}
	
	// 表单
	cols = [
		{ title: '参数名称', 	dataIndex: 'param_name', 	width:'50%' },
		{ title: '参数内容', 	dataIndex: 'param_cont', 		width:'50%' },
	]
	
	// 操作按钮
	controls = () => {
		const { disabled } = this.props
		return [
			Controls.add.call(this,{code:false, disabled}),
			Confirm.call(this,'删除', 'report-cats/delparam', { isKeys: true, ghost:true, onRefresh:this.props.onRefresh })
		]
	}
	render(){
		const { disabled } = this.props
		return (
			<>
				<Box title='其它参数' controls={this.controls()} className='mt5' contentClassName='pt10'>
					{/* 表格 */}
					{ Table.call(this, { wrapStyle: this.props.tableStyle, ...this.props, disabled }) }
				</Box>
				{/* 添加 */}
				{ AddEditModal.call(this,{ title: '其它参数', labelWidth:'s6', width:600, api:'report-cats/addparam'}) }
			</>
		)
	}
}

export default Index